/*
 * @Author: xushuhao
 * @Email: xshmouse@163.com
 * @Date: 2020-04-20 15:55:55
 * @Last Modified by: xushuhao
 * @Last Modified time: 2020-07-22 10:00:02
 * @Description: SF Symbols Icon 显示
 */

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_code_framework/base/base_widget.dart';
import 'package:flutter_code_framework/utils/global.dart';
import 'package:flutter_sfsymbols/flutter_sfsymbols.dart';

class DemoSFSymbols extends BaseWidget {
  @override
  BaseWidgetState<BaseWidget> getState() {
    return _DemoSFSymbolsState();
  }
}

class _DemoSFSymbolsState extends BaseWidgetState<DemoSFSymbols> {
  var list = [
    Row(
      children: <Widget>[
        Icon(SFSymbols.pencil_outline),
        Text('pencil_outline')
      ],
    ),
    Row(
      children: <Widget>[Icon(SFSymbols.rotate_left), Text('rotate_left')],
    ),
    Row(
      children: <Widget>[Icon(SFSymbols.rotate_right), Text('rotate_right')],
    ),
    Row(
      children: <Widget>[
        Icon(SFSymbols.arrowshape_turn_up_left_circle),
        Text('arrowshape_turn_up_left_circle')
      ],
    ),
    Row(
      children: <Widget>[
        Icon(SFSymbols.arrowshape_turn_up_right_circle),
        Text('arrowshape_turn_up_right_circle')
      ],
    ),

    Row(
      children: <Widget>[Icon(SFSymbols.chevron_left), Text('chevron_left')],
    ),
    Row(
      children: <Widget>[Icon(SFSymbols.rosette), Text('rosette')],
    ),
    Row(
      children: <Widget>[
        Icon(SFSymbols.arrow_right_arrow_left_circle),
        Text('arrow_right_arrow_left_circle')
      ],
    ),
    Row(
      children: <Widget>[Icon(SFSymbols.person_2), Text('person_3')],
    ),
    Row(
      children: <Widget>[Icon(SFSymbols.person_2_fill), Text('person_3_fill')],
    ),
    Row(
      children: <Widget>[Icon(SFSymbols.play_fill), Text('play_fill')],
    ),
    Row(
      children: <Widget>[Icon(SFSymbols.pause_fill), Text('pause_fill')],
    ),
    Row(
      children: <Widget>[Icon(SFSymbols.stop_fill), Text('stop_fill')],
    ),
    Row(
      children: <Widget>[
        Icon(SFSymbols.forward_end_fill),
        Text('forward_end_fill')
      ],
    ),
    Row(
      children: <Widget>[
        Icon(SFSymbols.mic_circle_fill),
        Text('mic_circle_fill')
      ],
    ),
    Row(
      children: <Widget>[Icon(SFSymbols.eye_slash), Text('eye_slash')],
    ),
    Row(
      children: <Widget>[Icon(SFSymbols.eye), Text('eye')],
    ),
    //
    Row(
      children: <Widget>[
        Icon(SFSymbols.tray_arrow_down_fill),
        Text('SFSymbols.tray_arrow_down_fill')
      ],
    ),
    Row(
      children: <Widget>[
        Icon(SFSymbols.tray_arrow_up_fill),
        Text('tray_arrow_up_fill')
      ],
    ),
    Row(
      children: <Widget>[
        Icon(SFSymbols.pin_slash_fill),
        Text('pin_slash_fill')
      ],
    ),
    Row(
      children: <Widget>[
        Icon(SFSymbols.tv_circle_fill),
        Text('tv_circle_fill')
      ],
    ),
    Row(
      children: <Widget>[Icon(SFSymbols.smiley), Text('smiley')],
    ),
    Row(
      children: <Widget>[
        Icon(SFSymbols.info_circle_fill),
        Text('info_circle_fill')
      ],
    ),
    Row(
      children: <Widget>[Icon(SFSymbols.play_circle), Text('play_circle')],
    ),
    Row(
      children: <Widget>[Icon(SFSymbols.multiply), Text('multiply')],
    ),
    Row(
      children: <Widget>[
        Icon(SFSymbols.person_crop_square),
        Text('person_crop_square')
      ],
    ),
    Row(
      children: <Widget>[Icon(SFSymbols.pencil_circle), Text('pencil_circle')],
    ),
    Row(
      children: <Widget>[
        Icon(SFSymbols.chevron_left_circle),
        Text('chevron_left_circle')
      ],
    ),
    Row(
      children: <Widget>[
        Icon(SFSymbols.chevron_right_circle),
        Text('chevron_right_circle')
      ],
    ),
    Row(
      children: <Widget>[Icon(SFSymbols.pencil_circle), Text('pencil_circle')],
    ),
    Row(
      children: <Widget>[Icon(SFSymbols.pencil_circle), Text('pencil_circle')],
    ),
    Row(
      children: <Widget>[Icon(SFSymbols.pencil_circle), Text('pencil_circle')],
    ),
    Row(
      children: <Widget>[
        Icon(SFSymbols.checkmark_seal_fill),
        Text('checkmark_seal_fill')
      ],
    ),
  ];

  @override
  Widget buildWidget(BuildContext context) {
    return ListView.builder(
        itemCount: list.length,
        itemExtent: 50.0, //强制高度为50.0
        shrinkWrap: true,
        itemBuilder: (BuildContext context, int index) {
          return Padding(
            padding: EdgeInsets.fromLTRB(24, 20, 24, 0),
            child: list[index],
          );
        });
  }

  @override
  void initState() {
    super.initState();
  }

  @override
  void onCreate() {
    // log("onCreate");
    setAppTopNavBarVisible(true);
    setTopNavTitle("SF 图标");
  }

  @override
  //自定义头部导航右侧操作区域
  Widget getTopNavRightWidget(_contextBaseFunction) {
    return GestureDetector(
      child: Container(
        child: Row(
          children: <Widget>[
            Text('健康', style: TextStyle(fontSize: 16)),
            Container(
              constraints: BoxConstraints(minWidth: 4),
              child: null,
            ),
            Icon(SFSymbols.heart_circle,
                size: 16, color: Theme.of(_contextBaseFunction).primaryColor),
          ],
        ),
      ),
      onTap: () {
        log('on tap');
      },
    );
  }

  @override
  void onPause() {
    // log('onPause');
  }

  @override
  void onResume() {
    // log("onResume");
  }
}
